# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-promise
pkgver=1.1_git20210307
_gitrev=cec51feb5f957e8febe6325335cf57dc2db6be30
pkgrel=0
_pkgreal=promise
pkgdesc="Simple implementation of Promises/A+"
url="https://github.com/chuntaro/emacs-promise"
arch="noarch"
license="GPL-3.0-or-later"
depends="cmd:emacs"
makedepends="emacs-nox"
checkdepends="emacs-ert-async"
source="https://github.com/chuntaro/emacs-promise/archive/$_gitrev/emacs-promise-$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"

build() {
	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l ert-async -l promise -l emacs-promise-test \
		-f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
36311aee3259960b4ed5b8dabe91c31ebab9aec1ad4b517356cb50014f130c850bfeae878d7b0ac17a92ad1122e90d784f496dd7e395c581ea43cb50d4f3663f  emacs-promise-cec51feb5f957e8febe6325335cf57dc2db6be30.tar.gz
"
